﻿function fixUrl(relativeUrl) {
    var protocal = window.location.protocol;
    var hostname = window.location.hostname;
    var port = window.location.port;

    if (hostname.indexOf("mobile.dow.com") > -1 || hostname.indexOf("iis64-root5") > -1) {
        return protocal + "//mobile.dow.com/apps/DASDemoTrial/" + relativeUrl;
    }
    else if (hostname.indexOf("preview-mobile-dow-com.bsndmz.com") > -1 || hostname.indexOf("iis64pre-root5") > -1) {
        return protocal + "//preview-mobile-dow-com.bsndmz.com/apps/DASDemoTrial/" + relativeUrl;
    }
        // for Debug only
    else if (hostname == "localhost" && port != 80 && port != "") {
        return protocal + "//" + hostname + ":" + port + "/" + relativeUrl;
    }

    else {
        return protocal + "//" + hostname + "/DASDemoTrial/" + relativeUrl;
    }
}